<template>
<div class="mui-numbox" data-numbox-min='1' :data-numbox-max='max'>
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input id="test" class="mui-input-numbox" @change="func" type="number" value="1" ref="mycount" />
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
</div>
</template>

<script>
import mui from '../../mui/js/mui.min.js'
export default {
    data(){
        return{
            // val:this.$refs.mycount.value
            // max:this.props.max
            val:1
        }
    },
    mounted(){
        mui('.mui-numbox').numbox()
    },
    methods:{
        func(){
            // console.log(this.val)
             this.val = this.$refs.mycount.value
            // console.log(this.val)
            // console.log(this.$refs.mycount.value)
            this.$emit('func',this.val)
        }
    },
    props:["max"],
    watch:{
        // 'max':function(newVal,oldVal){
        //     mui(".mui-numbox").numbox().setOption("max",newVal)
        // }
        // 'val':function(newVal,oldVal){
        //     console.log(newVal)
        // }
    }
}
</script>

<style lang="less" scoped>

</style>